.class public Llt/noframe/gpsfarmguide/control/LocaleChecker;
.super Ljava/lang/Object;
.source "LocaleChecker.java"


# static fields
.field public static final APP_TRANSLATION_DELAY:Llt/minvib/magicpreferences/MagicIntegerPreference;

.field public static final APP_TRANSLATION_INVITE_DELIVERED:Llt/minvib/magicpreferences/MagicBooleanPreference;


# direct methods
.method static constructor <clinit>()V
    .locals 4

    .line 21
    new-instance v0, Llt/minvib/magicpreferences/MagicBooleanPreference;

    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    const/4 v2, 0x0

    const-string v3, "app_translation_invite_delivered"

    invoke-direct {v0, v2, v3, v1}, Llt/minvib/magicpreferences/MagicBooleanPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)V

    sput-object v0, Llt/noframe/gpsfarmguide/control/LocaleChecker;->APP_TRANSLATION_INVITE_DELIVERED:Llt/minvib/magicpreferences/MagicBooleanPreference;

    .line 23
    new-instance v0, Llt/minvib/magicpreferences/MagicIntegerPreference;

    const/4 v1, 0x2

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v3, "app_translation_delay"

    invoke-direct {v0, v2, v3, v1}, Llt/minvib/magicpreferences/MagicIntegerPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V

    sput-object v0, Llt/noframe/gpsfarmguide/control/LocaleChecker;->APP_TRANSLATION_DELAY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .line 19
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public checkLocale(Landroid/content/Context;)Z
    .locals 4

    .line 27
    sget-object v0, Llt/noframe/gpsfarmguide/control/LocaleChecker;->APP_TRANSLATION_INVITE_DELIVERED:Llt/minvib/magicpreferences/MagicBooleanPreference;

    invoke-virtual {v0, p1}, Llt/minvib/magicpreferences/MagicBooleanPreference;->get(Landroid/content/Context;)Ljava/lang/Boolean;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    return v1

    .line 31
    :cond_0
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;

    move-result-object v0

    .line 32
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v2

    invoke-virtual {v2}, Ljava/util/Locale;->getCountry()Ljava/lang/String;

    const v2, 0x7f110129

    .line 34
    invoke-virtual {p1, v2}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v2

    const-string v3, "_"

    .line 36
    invoke-virtual {v2, v3}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v2

    .line 37
    array-length v3, v2

    if-lez v3, :cond_2

    .line 38
    aget-object v2, v2, v1

    invoke-virtual {v0, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    .line 40
    sget-object v0, Llt/noframe/gpsfarmguide/control/LocaleChecker;->APP_TRANSLATION_DELAY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    invoke-virtual {v0, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    const/4 v2, 0x1

    if-gt v0, v2, :cond_1

    .line 43
    invoke-virtual {p0, p1}, Llt/noframe/gpsfarmguide/control/LocaleChecker;->showLocaleNotTheSameDialog(Landroid/content/Context;)V

    return v2

    :cond_1
    add-int/lit8 v0, v0, -0x1

    .line 47
    sget-object v2, Llt/noframe/gpsfarmguide/control/LocaleChecker;->APP_TRANSLATION_DELAY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v2, p1, v0}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    :cond_2
    return v1
.end method

.method protected showLocaleNotTheSameDialog(Landroid/content/Context;)V
    .locals 3

    .line 57
    new-instance v0, Landroidx/appcompat/app/AlertDialog$Builder;

    invoke-direct {v0, p1}, Landroidx/appcompat/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    const-string v1, "Unsupported display language"

    .line 58
    invoke-virtual {v0, v1}, Landroidx/appcompat/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroidx/appcompat/app/AlertDialog$Builder;

    const-string v1, "Your device language isn\'t supported by this app. If you would like to help translate this app to your language, contact us now."

    .line 59
    invoke-virtual {v0, v1}, Landroidx/appcompat/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroidx/appcompat/app/AlertDialog$Builder;

    const v1, 0x7f110096

    .line 60
    invoke-virtual {p1, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Llt/noframe/gpsfarmguide/control/LocaleChecker$2;

    invoke-direct {v2, p0, p1}, Llt/noframe/gpsfarmguide/control/LocaleChecker$2;-><init>(Llt/noframe/gpsfarmguide/control/LocaleChecker;Landroid/content/Context;)V

    invoke-virtual {v0, v1, v2}, Landroidx/appcompat/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroidx/appcompat/app/AlertDialog$Builder;

    const v1, 0x7f110155

    .line 66
    invoke-virtual {p1, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v1

    new-instance v2, Llt/noframe/gpsfarmguide/control/LocaleChecker$1;

    invoke-direct {v2, p0, p1}, Llt/noframe/gpsfarmguide/control/LocaleChecker$1;-><init>(Llt/noframe/gpsfarmguide/control/LocaleChecker;Landroid/content/Context;)V

    invoke-virtual {v0, v1, v2}, Landroidx/appcompat/app/AlertDialog$Builder;->setNegativeButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroidx/appcompat/app/AlertDialog$Builder;

    const/4 p1, 0x0

    .line 72
    invoke-virtual {v0, p1}, Landroidx/appcompat/app/AlertDialog$Builder;->setCancelable(Z)Landroidx/appcompat/app/AlertDialog$Builder;

    .line 73
    invoke-virtual {v0}, Landroidx/appcompat/app/AlertDialog$Builder;->show()Landroidx/appcompat/app/AlertDialog;

    return-void
.end method
